UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ciuEk9fkTAj8cnEvnb5eoV8KkJvIQYuqO3IVQPX5D+c='
WHERE
key_id = '52e9ef0d71cfe4499d6a292cb9f4ba251084aec7ccb7daf8f21d5230a87095cb'
AND (
token = 'ciuEk9fkTAj8cnEvnb5eoV8KkJvIQYuqO3IVQPX5D+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)