UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'StU+JZ4X5tVE7+tbvLSrlhGAq5X9B03WS+ZzbjQTytk=' 
WHERE 
  key_id = '50f0adb494f1e33179485af410b0ed0e6e3842315d0ebd5b4b79e6580987bd77' 
  AND (
    token = 'StU+JZ4X5tVE7+tbvLSrlhGAq5X9B03WS+ZzbjQTytk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033