UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0coSmbu6bDc6uPAsDZixSdOR+3dextGmYb9BJvjcjJg=' 
WHERE 
  key_id = '082431098d1f99a53140cc9356f843fb46a8f0625db771e57536639969955394' 
  AND (
    token = '0coSmbu6bDc6uPAsDZixSdOR+3dextGmYb9BJvjcjJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037