UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b+Rmf/4Vx9TxouWSfrraNNZcCYgEIkID62Oah861jfw=' 
WHERE 
  key_id = '2dd8bc3c602995a32bba90590459cf76481624e73240789e4e11f888d6d0bf39' 
  AND (
    token = 'b+Rmf/4Vx9TxouWSfrraNNZcCYgEIkID62Oah861jfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020