UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I73DskhW+rFYjPYpc1NEgzvdpzOglyZMSFZnfV6TXO4='
WHERE
key_id = 'e9c7f4392184681cd57934f2b83f2befa4c8926a5c67c825aa17db984af648af'
AND (
token = 'I73DskhW+rFYjPYpc1NEgzvdpzOglyZMSFZnfV6TXO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)