UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's4SgCpNU2wGxBExFq21qKRsn5JqMlp5D1q2fyHS3Vdo='
WHERE
key_id = 'c4f6353bab7471b9b8959866d3fcfcf1e2923fe81557ad2163a2fd76d70c03a6'
AND (
token = 's4SgCpNU2wGxBExFq21qKRsn5JqMlp5D1q2fyHS3Vdo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)