UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0P/gPnirgu6pddO5RVR1mDIOAiBkE+x/IO+YXyxMSMM='
WHERE
key_id = '502f4e65aa38d03aae53c9040180ad7de9d034c60a8b18a8419856186229387d'
AND (
token = '0P/gPnirgu6pddO5RVR1mDIOAiBkE+x/IO+YXyxMSMM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)