UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd8cI+dwyG5taYVvi11624cCpn6RjSI5wFe7lBkGq+sc='
WHERE
key_id = 'a6de203eb9cfd3aa9eb121f6445ad6922a7787e442efa37c2957cd7945ef33e3'
AND (
token = 'd8cI+dwyG5taYVvi11624cCpn6RjSI5wFe7lBkGq+sc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)