UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JsL5qJZ0KDYQJkv08Zp2vFkJzmO94tn+vNo1V1xAGTs='
WHERE
key_id = '432bd77efae634eee27e7cee7128ff17128bada4d17addf5f0e6d5b09fd61d9a'
AND (
token = 'JsL5qJZ0KDYQJkv08Zp2vFkJzmO94tn+vNo1V1xAGTs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)