UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oPBAy3f8G/8pB1msUkuY2ngO+STevvfzz/PgYWpQM6I='
WHERE
key_id = 'cdbabe9a90af1bcfbf24b580f1136af1a21764b6f9d44d72be14ffaa1a9becfe'
AND (
token = 'oPBAy3f8G/8pB1msUkuY2ngO+STevvfzz/PgYWpQM6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)