UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PrIRIxqEL+fp7VEMUk0zuoEBTTQMx+BcVUwKCgEmW1U='
WHERE
key_id = 'e629b8c32d1efe2fb2aeb57e05e4fc7556a438926be795b401288b1801c20b85'
AND (
token = 'PrIRIxqEL+fp7VEMUk0zuoEBTTQMx+BcVUwKCgEmW1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)