UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EdLSj8D4ojQxT3JPrpUaUdOAD+vXgiDtD37rSf2hnGU='
WHERE
key_id = '49049c5afbe5fb9b71ebb13df067edefcc317c451e69ad123dc80b575ca44df4'
AND (
token = 'EdLSj8D4ojQxT3JPrpUaUdOAD+vXgiDtD37rSf2hnGU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)