UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WAnJZKkL0GktIHkZaH8t34/k+b4Yy3yVLIS3u0rPeGU=' 
WHERE 
  key_id = 'e152285c30bbcc7150344601b45763641a70a204f94db0edb182ecebde1ca8a1' 
  AND (
    token = 'WAnJZKkL0GktIHkZaH8t34/k+b4Yy3yVLIS3u0rPeGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027