UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N4tUYwukQPGZByXGwR1PLbRL53EQw2D/ne8yvnhd2Ps=' 
WHERE 
  key_id = 'b50f2c671add792b50c124fb08d9a4c496262817cdf8ad37fc18aa59d0da45b8' 
  AND (
    token = 'N4tUYwukQPGZByXGwR1PLbRL53EQw2D/ne8yvnhd2Ps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026