UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZTFiSF3+J/vORHdpk/5h4Mpeyxa80Cz2nBArGXSRRD0='
WHERE
key_id = '5f763c345fe2a50ecb0e2c13db80710aef91a80e09b54fdda77b09664f91496d'
AND (
token = 'ZTFiSF3+J/vORHdpk/5h4Mpeyxa80Cz2nBArGXSRRD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)