UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mGbbAWPsrPtImg9CRY4oW91uCgt9lVQ1m152QchV44U='
WHERE
key_id = '313c6913752a896a195cfed116cccc6cd4d4aa5a2f50a4bc1c3009fbbe0f37c5'
AND (
token = 'mGbbAWPsrPtImg9CRY4oW91uCgt9lVQ1m152QchV44U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)