UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uUPeke8fD22EEN7fVa5EjLBRMayiE+jr9Hif+/jUUdI='
WHERE
key_id = 'e16c0474189d492223d5583b2117aa1553f00d05a62204b637495f2f3060145f'
AND (
token = 'uUPeke8fD22EEN7fVa5EjLBRMayiE+jr9Hif+/jUUdI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)