UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TmSRWbjWBHDSngHBFe3B6maGs7b1kWByCNJ5BcXPLDI='
WHERE
key_id = 'd238d2f79e08af7be52fcbfcdb3e5b103c7314e69fab08d863af79b82e890e46'
AND (
token = 'TmSRWbjWBHDSngHBFe3B6maGs7b1kWByCNJ5BcXPLDI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)