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