UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gxnpdAcUJBg0JJe60DF4QvX6hzFTE0vkvIDjuCRPLmw='
WHERE
key_id = 'ac52909d7fe2b57c8d6cd74ebec3dc88064dd44e8951031a34160c818850a284'
AND (
token = 'gxnpdAcUJBg0JJe60DF4QvX6hzFTE0vkvIDjuCRPLmw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)