UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UoUH0B5aKnAa6bZnvopCIqErCNsrpfQ1fred2HCUuaI='
WHERE
key_id = '6b15884de2cf7a8fad4de7dfa4c44e899818016da6e6e2dd131447332704357d'
AND (
token = 'UoUH0B5aKnAa6bZnvopCIqErCNsrpfQ1fred2HCUuaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)