UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q7sKeKDpBAcOZ1etzWnsAjE05iUiPuVt8UsD3SQDAag='
WHERE
key_id = '311d5a4db5fa974ba89dc095e8625f1b66eecad2b1fa021a0a74f9d03ac4ef5e'
AND (
token = 'Q7sKeKDpBAcOZ1etzWnsAjE05iUiPuVt8UsD3SQDAag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)