UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Vi2lFy81wOG2ylzCkywTUl3ZkMgA1D+0Yn3rtjL3Uac='
WHERE
key_id = 'c22e453f08154ee2618474a8f27b889807e96d682d990cab040c0fe0e927e245'
AND (
token = 'Vi2lFy81wOG2ylzCkywTUl3ZkMgA1D+0Yn3rtjL3Uac='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)