UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0TQ1w4qR8grgAU8hP6faF9zgej4tcUQAwD4Gz93iNdA='
WHERE
key_id = '5cb90683f12f6020f76891a6b22f688a75652b68bf5b876414bad9df21ce6ad5'
AND (
token = '0TQ1w4qR8grgAU8hP6faF9zgej4tcUQAwD4Gz93iNdA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)