UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7kCDL0AhZz63YKKtm9P/T5pcLJNTx014GCq9eLpeowc='
WHERE
key_id = 'c5f714ab32f124c48f6eaab815f65469401586a598978d3b53d7674283101318'
AND (
token = '7kCDL0AhZz63YKKtm9P/T5pcLJNTx014GCq9eLpeowc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)