UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lug9f8I9G64rQTvUCXLO1Bzl71+5EMRoVre3Lj98HCA='
WHERE
key_id = 'ca54badcacb9a3950e87a94c50596de9244759201168f8ea6627e5f037e8d763'
AND (
token = 'Lug9f8I9G64rQTvUCXLO1Bzl71+5EMRoVre3Lj98HCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)