UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0XUVPZV9/8fT8ddcqvLIxkjZpfCBUuaGJBFewWa9x6g='
WHERE
key_id = 'fb6a199017d8b2c138e05ea2c50ef5f54c0d2df237614541b143f2ce99c467b1'
AND (
token = '0XUVPZV9/8fT8ddcqvLIxkjZpfCBUuaGJBFewWa9x6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)