UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PwNeRFiZTPLwyrHc6QljcX14qa9VMkX+VQXEbxH+sVc='
WHERE
key_id = 'ff481d59207b08d46ad555694ebfd2bfd29b81009f7250aa485fc1006b769344'
AND (
token = 'PwNeRFiZTPLwyrHc6QljcX14qa9VMkX+VQXEbxH+sVc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)