UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y0vS+auYF0Gep9r6Y1J1CXcRJgrKWSubk+4ZjlchBwI=' 
WHERE 
  key_id = '1443688189391ab4bd120a27b912765e745a73b80eaa41817fa4ad41a58916a9' 
  AND (
    token = 'y0vS+auYF0Gep9r6Y1J1CXcRJgrKWSubk+4ZjlchBwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018