UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tN/ER5DFyhl8I4xnZqnD/HPz+XR34MYJ9LhqSry5P5k=' 
WHERE 
  key_id = '87a889212367834bf35748fed337f77174a1cd8b74c3d047fd3b8bc27eff281c' 
  AND (
    token = 'tN/ER5DFyhl8I4xnZqnD/HPz+XR34MYJ9LhqSry5P5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033