UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zgALHxiDTaaU6RdWgym0PgyWN67TKQVywVqllykdTes='
WHERE
key_id = '06fe514f4271ff381adba019f442cdd197cc11974fcaa2ac458b67218c23cbfc'
AND (
token = 'zgALHxiDTaaU6RdWgym0PgyWN67TKQVywVqllykdTes='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)