UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ydpWTT59SY7R5hSVOloAUmEJ+4wEveiU/v5GIWhfA0w='
WHERE
key_id = '8d91b8437dacb8d94bb3748941eb74b28e8b778b8ba66b443c281e6b122404be'
AND (
token = 'ydpWTT59SY7R5hSVOloAUmEJ+4wEveiU/v5GIWhfA0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)