UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y7GGLP4KbTevcrzhZYw8fjDJzVIPv/8kaSbSCYCTyPY='
WHERE
key_id = 'c8def35484b312c4c673c74557bc7fb788bc03e6607371dd07a542cb8cfb708b'
AND (
token = 'Y7GGLP4KbTevcrzhZYw8fjDJzVIPv/8kaSbSCYCTyPY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)