UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IuGQTJp2a2oS+wYzv/Lpph1Qe3jxNNx9EEH+gnyLgOY=' 
WHERE 
  key_id = '7fd2d84f7e07b658f74a8b747f26c5225d1cb33439bda6798ad37a8db269c167' 
  AND (
    token = 'IuGQTJp2a2oS+wYzv/Lpph1Qe3jxNNx9EEH+gnyLgOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041