UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9CoXTM3OFT52j+KnYf9V9bTe6Vr8jjmxX53HAJykMHs=' 
WHERE 
  key_id = 'd88e2854f189eceee382ecdb2b7faeafb7510cd123da20acb18f97a96f713ac4' 
  AND (
    token = '9CoXTM3OFT52j+KnYf9V9bTe6Vr8jjmxX53HAJykMHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00095