UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q01zDpfb4k37CC23CDRfS2ZSDRfDJh39bMaWq4w5Z+4='
WHERE
key_id = 'f9eaa5d7bfa275787497628b63be84b844700d025ddde1796cec13950deda0ef'
AND (
token = 'Q01zDpfb4k37CC23CDRfS2ZSDRfDJh39bMaWq4w5Z+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)