UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WTQtsBXXU12zLLT0ir13FbPPaJCFIaiKhIZO9bDvpLs=' 
WHERE 
  key_id = '8cb8fcff72207e0e0ebf52ed56cace01048fcd04b47a128226d1aa97be6ef917' 
  AND (
    token = 'WTQtsBXXU12zLLT0ir13FbPPaJCFIaiKhIZO9bDvpLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044