UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jYb8yZQ6LKfUkcsAipeh/QbGdhIznhXicSII6UY8D9Y='
WHERE
key_id = 'd1e173e5a8ee736355bbc12f7f65eebb74f537d64820de9d2e3ef2b0addcf96e'
AND (
token = 'jYb8yZQ6LKfUkcsAipeh/QbGdhIznhXicSII6UY8D9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)